package com.itbaizhan.escase.log;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;


import java.util.Date;
@NoArgsConstructor
@AllArgsConstructor
@Data
@ToString
public class Log {
    private  String id;
    //把json格式转为下面的格式   GMT+8：时区
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date  visitTime;  //访问时间
    private long executionTime;//访问时长
    private String ip;  //访问ip
    private String url;//访问路径
    private String method;//访问方法
    private int level;  //日志等级  0：正常  1：警告  2：异常
    private String message;//异常信息
    private String stackTrace;//异常栈信息

    //没有异常的构造方法
    public Log(String id, Date visitTime, long executionTime, String ip, String url, String method, int level) {
        this.id = id;
        this.visitTime = visitTime;
        this.executionTime = executionTime;
        this.ip = ip;
        this.url = url;
        this.method = method;
        this.level = level;
    }


}
